package com.bwie.goods.controller;

import com.bwie.common.domain.Store;
import com.bwie.common.domain.request.StoreRequest;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.goods.service.StoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/Store")
public class StoreController {
    @Autowired
    StoreService storeService;

    /**
     * 列表
     * @param storeRequest
     * @return
     */
    @PostMapping("/list")
    public Result<PageResult<Store>> list(@RequestBody StoreRequest storeRequest) {
        return storeService.list(storeRequest);
    }

    /**
     * 上传
     * @param file
     * @return
     */
    @PostMapping("/upload")
    public Result upload(@RequestParam("file")MultipartFile file){
        Result result=storeService.upload(file);
        return result;
    }

    /**
     * 添加
     * @param store
     * @return
     */
    @PostMapping("/add")
    public Result add(@RequestBody Store store){
        Result result=storeService.add(store);
        return result;
    }

}
